﻿using System;

namespace Sessionizer.Tests.Abstraction
{
    public static class IoCContainerBuilderExtensions
    {
        public static IIoCContainerBuilder RegisterType<T>(
            this IIoCContainerBuilder builder,
            LifetimeStyle lifetimeStyle = LifetimeStyle.Transient
            )
        {
            return builder.RegisterType(typeof (T), typeof (T), lifetimeStyle);
        }

        public static IIoCContainerBuilder RegisterType<TComponent, TImplementation>(
            this IIoCContainerBuilder builder,
            LifetimeStyle lifetimeStyle = LifetimeStyle.Transient
            )
        {
            return builder.RegisterType(typeof (TComponent), typeof (TImplementation), lifetimeStyle);
        }


        public static IIoCContainerBuilder RegisterType(
            this IIoCContainerBuilder builder,
            Type componentType,
            LifetimeStyle lifetimeStyle = LifetimeStyle.Transient
            )
        {
            return builder.RegisterType(componentType, componentType, lifetimeStyle);
        }

        public static IIoCContainerBuilder RegisterType(
            this IIoCContainerBuilder builder,
            Type componentType,
            Type implementingType,
            LifetimeStyle lifetimeStyle = LifetimeStyle.Transient
            )
        {
            return builder.RegisterType(componentType, implementingType, lifetimeStyle);
        }
    }
}